Huffman decoding method

ABSTRACT

The present invention relates to a Huffman decoding method. Firstly, a Huffman table including multiple Huffman codes and multiple corresponding size/symbol codes is extracted. Each Huffman code comprises a codeword and each size/symbol code comprises a size code and a symbol code. Then, multiple mask codes are generated according to the size codes. Then, masking operations are performed on successive 16 bits of the compression bit stream and the mask codes, thereby outputting multiple masking results. Subsequently, logic operations on the masking results and the Huffman codes, thereby generating multiple are performed on the new Huffman codes, wherein each new Huffman code includes the codeword. It is discriminated whether the 16 bits of the compression bit stream complies with a specific one of new Huffman codes, thereby outputting the size/symbol code corresponding to the codeword.

FIELD OF THE INVENTION

The present invention relates to a decoding method, and moreparticularly to a Huffman decoding method.

BACKGROUND OF THE INVENTION

Huffman encoding algorithm is widely used in compression of video andimage data, for example in JPEG and MPEG compression. As known,identical symbols (e.g. A, B, C, etc.) included in a file to becompressed may be repeatedly occurred. Based on the frequency ofoccurrence of the symbols in the file that is being compressed, Huffmanencoding algorithm encodes symbols by assigning thereto respectivecodewords having lengths corresponding to probabilities of occurrence ofthe symbols. In a case that the occurrence of a symbol is more frequent,the length of the encoded symbol is shorter. Take a file having dataABCBCDCDDD for example. The frequency of occurrence for the symbol A is1, for the symbol B is 2, for the symbol C is 3 and for the symbol D is4. Since the symbol D has the most probable occurrence, the symbol D isassigned with a codeword having the shortest code length or bit-size. Incontrast, since the symbol A has the least probable occurrence, thesymbol A is assigned with a codeword having the longest code length orbit-size. For example, the symbol A is assigned with a codeword“11111111”, the symbol B is assigned with a codeword “00000”, the symbolC is assigned with a codeword “111” and the symbol D is assigned with acodeword “00”. By assigning smaller codes to more frequently usedsymbols and larger codes for less frequently used symbols, Huffmancompression is a variable-length encoding system of reducing the size offiles being compressed.

For reading the contents of the original file, the compressed fileshould be decompressed and then decoded by using a Huffman table asshown in FIG. 1. Referring to FIG. 1, the Huffman table includes severalcolumns such as an address column, a symbol column, a size column and acodeword column. The address column denotes the address of the codewordstored in the memory. The size column denotes the bit-size of thecodeword. The codeword column denotes the Huffman code of the encodedsymbol. For example, the symbol J shown in FIG. 1 is assigned with acodeword “0110110” having a bit size of 7 (i.e. 7 bits). In other words,the input data “0110110” are encoded by the Huffman decoder into acorresponding symbol J and the bit-size is 7.

Nowadays, a nice way of visualizing the process of decoding a filecompressed with Huffman encoding is to use a binary tree. A Huffmandecoding method of using a binary tree-based search was disclosed inU.S. Pat. No. 6,621,429. According to the binary tree-based search, theHuffman table describes a binary tree corresponding to the Huffman code.Starting from the uppermost node, each node has two branches connectedthereto so as to construct the binary tree.

Please refer to FIG. 2, which is a schematic view showing a binary treecreated from the Huffman table of FIG. 1. Generally, if the Huffmantable is changed, the configurations of the binary tree are varied. Thebinary tree of FIG. 2 stores each data (symbol) in a corresponding leafnode. By a Huffman decoder, a symbol search begins at the root of abinary tree and ends at any of the leaves. One bit for each node isextracted from bit-stream while traversing the binary tree. The code fora symbol is obtained by following the path from the root to the leafnode containing that symbol. The low-level bit 0 of the input data isassigned to a left branch, and the high-level bit 1 is assigned to aright branch. After a symbol corresponding to the bit is searched, anext bit of the input data is extracted and then decoded as describedabove.

For example, an input data stream “011101” to be decoded is illustratedwith reference to FIG. 2. As to the node 11, the first bit data “0” isassigned to the left branch to the node 12. As to the node 12, thesecond bit data “1” is assigned to the right branch to the node 13. Asto the node 13, the third bit data “1” is assigned to the right branchto the node 14. As to the node 14, the fourth bit data “1” is assignedto the right branch to the node 19. As to the node 19, the fifth bitdata “0” is assigned to the left branch to the node 20. As to the node20, the sixth bit data “1” is assigned to the right branch to the leafnode storing that symbol F. That is, the input data stream “011101 maybe decoded into the symbol F. After the leaf node is searched, a newinput data stream is continuously read and a symbol search begins at theroot node 11 again. The binary tree search procedures are repeated untilall input data streams are recoded.

Since the bits of the input data stream are decoded one by one, theprocessing speed of such binary tree search method is very slow and isnot suitable to decode abundant compressed files. Therefore, there is aneed to provide a Huffman decoding method for decoding Huffman codes ata high speed.

SUMMARY OF THE INVENTION

It is an object of the present invention to provide a Huffman decodingmethod capable of decoding Huffman codes at a high speed.

In accordance with a first aspect of the present invention, there isprovided a Huffman decoding method for decoding a compression bit streaminto corresponding size/symbol codes. Firstly, a Huffman table includingmultiple Huffman codes and multiple corresponding size/symbol codes isextracted. Each Huffman code includes a codeword having variable codelength and each size/symbol code includes a size code and a symbol code.Then, multiple mask codes are generated according to the size codes.Then, masking operations are performed on successive 16 bits of thecompression bit stream and the mask codes, thereby outputting multiplemasking results. Subsequently, logic operations are performed on themasking results and the Huffman codes, thereby generating multiple thenew Huffman codes, wherein each new Huffman code includes the codeword.It is discriminated whether the 16 bits of the compression bit streamcomplies with a specific one of new Huffman codes, thereby outputtingthe size/symbol code corresponding to the codeword.

In an embodiment, each mask code is composed of 16 binary codes andincludes a valid bit portion and an invalid bit portion, wherein thebit-size of the valid bit portion of the mask code is determinedaccording to the size code.

In an embodiment, an AND gate and an OR gate are used for performing themasking operation and the logic operation, respectively, when the bit“0” indicates a valid bit and the bit “1” indicates an invalid bit.

In an embodiment, an OR gate and an AND gate are used for performing themasking operation and the logic operation, respectively, when the bit“1” indicates a valid bit and the bit “0” indicates an invalid bit.

In accordance with a second aspect of the present invention, there isprovided a Huffman decoding device for decoding a compression bit streaminto corresponding size/symbol codes. The Huffman decoding devicecomprises a Huffman table extracting and processing unit, a Huffmanmemory, a symbol and size code memory, a mask memory, a compression bitstream processing unit, a Huffman code processing unit and a Huffmandecoding unit. The Huffman table extracting and processing unit is usedfor extracting a Huffman table and generating multiple mask codes. TheHuffman table includes multiple Huffman codes and multiple correspondingsize/symbol codes. Each Huffman code includes a codeword having variablecode length, each size/symbol code includes a size code and a symbolcode, and the mask codes are generated according to the size codes. TheHuffman memory is electrically connected to the Huffman table extractingand processing unit for storing the Huffman codes therein. The symboland size code memory is electrically connected to the Huffman tableextracting and processing unit for storing the size/symbol codestherein. The mask memory is electrically connected to the Huffman tableextracting and processing unit for storing the mask codes therein. Thecompression bit stream processing unit is electrically connected to themask memory and performing masking operations on successive 16 bits ofthe compression bit stream and the mask codes, thereby outputtingmultiple masking results. The Huffman code processing unit iscommunicated with the Huffman table extracting and processing unit forperforming logic operations on the masking results and the Huffmancodes, thereby generating multiple new Huffman codes, wherein each newHuffman code includes the codeword. The Huffman decoding unit iscommunicated with the Huffman table extracting and processing unit fordiscriminating whether the 16 bits of the compression bit streamcomplies with a specific one of new Huffman codes, thereby outputtingthe size/symbol code corresponding to the specific new Huffman code.

The above objects and advantages of the present invention will becomemore readily apparent to those ordinarily skilled in the art afterreviewing the following detailed description and accompanying drawings,in which:

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 schematically illustrates a conventional Huffman table;

FIG. 2 is a schematic view showing a binary tree created from theHuffman table of FIG. 1;

FIG. 3( a) schematically illustrates a data code definition for theHuffman table used in the present invention;

FIG. 3( b) schematically illustrates a Huffman table used in the presentinvention;

FIG. 3( c) is a schematic circuit block diagram of a Huffman decodingdevice according to a first preferred embodiment of the presentinvention; and

FIG. 3( d) is a schematic circuit block diagram of a Huffman decodingdevice according to a second preferred embodiment of the presentinvention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

The present invention relates to a Huffman decoding method. First ofall, a Huffman table is provided in a Huffman decoder to describe theHuffman codes. Take a JPEG file for example. Generally, a standard JPEGHuffman table has been previously provided in the decoder. The standardJPEG Huffman table includes codewords for most JPEG files in order to beused for decoding most compressed JPEG data. On the other hand, theapplication of the standard JPEG Huffman table is restricted becausesome JPEG files have specific decompression requirements. As aconsequence, the manufacture may design specified Huffman tables asrequired. These specified Huffman table are stored in the header of theJPEG file. When the decoding operation is initiated, the specifiedHuffman tables will be downloaded from the JPEG file to the decoderthrough the bus.

Referring to FIG. 3( a), a data code definition for the Huffman tableused in the present invention is illustrated. The data code 310 is a32-bit code. The first two bits of the data code 310 denote chromavalue, luma value, AC coefficient and DC coefficient. The next twentybits indicate the Huffman code 320. Each Huffman code 320 includes acodeword having variable code length. The next five bits denotes asymbol code 3301. The five bits subsequent to the symbol code 3301 is asize code 3302. In this embodiment, the symbol code 3301 and the sizecode 3302 are cooperatively referred as a size/symbol code 330. In thisembodiment, the Huffman code 320 is illustrated by referring to a 16-bitcode because the 16-bit Huffman code is commonly used. Nevertheless, theHuffman code 320 of the present invention can be expanded to 20 bits inorder to decode higher-bit Huffman code and increase the applicationspectrum.

Referring to FIG. 3( b), an embodiment of a Huffman table used in thepresent invention is illustrated. As shown in FIG. 3( b), the Huffmantable includes several columns such as an address column, a symbolcolumn, a size column and a Huffman code column. The meanings of theaddress column, the symbol column and the size column are identical tothose described in FIG. 1, and are not described redundantly herein. Aspreviously described, the codeword column in the conventional Huffmantable denotes the Huffman code of the encoded symbol. Instead of thecodeword column, the preceding one or more bits of the Huffman codeshown in the Huffman code column of FIG. 3( b) denotes the codeword. Inother words, the codeword having variable code length is included in the16-bit Huffman code. As a consequence, the Huffman decoder may performthe decoding operations regardless of whether the exact code length ofthe codeword is realized. In addition, the size code denotes bit-size ofthe codeword and is measure of deciding the mask code. The mask codeincludes a valid bit portion and an invalid bit portion. The bit-size ofthe valid bit portion of the mask code is determined according to thesize code. In this embodiment, the Huffman code includes the codewordand the valid bit portion of the mask code. The low-level bit “0” isassigned to the valid bit portion and the high-level bit “1” is assignedto the invalid bit portion. For example, the symbol A at the address “0”has a size code “1” and is assigned with a codeword “1”, the Huffmancode is “1000,0000,0000,0000”, which includes the size code “1” and theremainder 15 valid bits “0”. Whereas, if the high-level bit “1” isassigned to the valid bit portion and the low-level bit “0” is assignedto the invalid bit portion, the Huffman code of the symbol A is“111,1111,1111,1111” which includes the size code “1” and the remainder15 valid bits “1”.

Referring to FIG. 3( c), a schematic circuit block diagram of a Huffmandecoding device according to a first preferred embodiment of the presentinvention is illustrated. The Huffman decoding device 300 iselectrically connected to a bus 301. Via the bus 301, the data code 310stored in the header of a compressed file (e.g. a JPEG file) may betransmitted to the Huffman decoding device 300, so that the data code310 is obtained by the Huffman decoding device 300. As shown in FIG. 3(c), the Huffman decoding device 300 includes a bus interface 302, aHuffman table extracting and processing unit 303, a Huffman memory 304,a symbol and size code memory 305, a mask memory 306, a compression bitstream processing unit 307, a Huffman code processing unit 308 and aHuffman decoding unit 309.

The Huffman decoding device 300 is communicated with the bus 301 throughthe bus interface 302 so as to receive the data code 310. The data code310 is processed by the Huffman table extracting and processing unit 303and classified into a Huffman code 320, a symbol code 3301 and a sizecode 3302, in which the symbol code 3301 and the size code 3302 arecooperatively referred as a size/symbol code 330. According to the sizecode 3302, a mask code 350 is generated. The Huffman code 320 is storedin the Huffman memory 304. The size/symbol code 330 is stored in thesymbol and size code memory 305. The mask code 350 is stored in the maskmemory 306. The compression bit stream processing unit 307 is employedto receive the compression bit stream 360 to be decoded. In response tothe mask code 350, the compression bit stream processing unit 307performs a masking operation on the compression bit stream 360, therebyoutputting a masking result 370. By the Huffman code processing unit308, a logic operation is performed on the masking result 370 and theHuffman code 320, thereby generating a new Huffman code 380. In responseto the new Huffman code 380, the compression bit stream 360 is decodedby the Huffman decoding unit 309.

Hereinafter, the operation principle of the circuit block diagram ofFIG. 3( c) will be illustrated as follows.

First of all, the compressed file to be decoded is transmitted to theHuffman decoding device 300 via the bus 301. In this embodiment, thecompressed file to be decoded includes for example the compression bitstream 360 and the data code 310. Multiple data codes 310 aretransmitted to the Huffman table extracting and processing unit 303through the bus interface 302.

Subsequently, as shown in FIG. 3( c), the multiple data codes 310 areprocessed by the Huffman table extracting and processing unit 303 andthus classified into Huffman codes 320, symbol codes 3301 and size codes3302. According to the size codes 3302, corresponding mask codes 350 aregenerated. Each mask code 350 includes a valid bit portion and aninvalid bit portion. The bit-size of the valid bit portion of the maskcode 350 is determined according to the size code 3302. Next, theHuffman codes 320, the size/symbol codes 330 and the mask codes 350 arestored in the Huffman memory 304, the symbol and size code memory 305and the mask memory 306, respectively. Then, 16 bits of a compressionbit stream 360 are successively inputted into the compression bit streamprocessing unit 307, and the mask codes 350 are issued from the maskmemory 306 to the bit stream processing unit 307. The compression bitstream processing unit 307 may perform a masking operation on the 16-bitcompression bit stream 360 and the mask code 350, thereby outputting amasking result 370.

The Huffman code processing unit 308 receives the Huffman codes 320 fromthe Huffman memory 304, and then performs a logic operation on theHuffman codes 320 and the masking result 370, thereby generating a newHuffman code 380. The new Huffman code 380 also includes a codewordhaving variable code length.

The Huffman decoding unit 309 receives the size/symbol codes 330 fromthe symbol and size code memory 305 and successively receives the 16bits of the compression bit stream 360. By means of the Huffman decodingunit 309, the 16-bit compression bit stream 360 is compared with the newHuffman code 380. When the 16-bit compression bit stream 360 complieswith the new Huffman code 380, the Huffman decoding unit 309 will outputthe corresponding size/symbol codes 330. Under this circumstance, thecodeword of the Huffman codes 320 is identical to the codeword of thenew Huffman code 380.

An implementation example of the present invention will be illustratedwith reference to the Huffman table of FIG. 3( b) and the circuit blockdiagram of FIG. 3( c).

In the present description, the compression bit stream indicates astream of input data having a codeword. The term “decoded” used hereinmeans that the size and the symbol on the Huffman table corresponding tothe codeword of the compression bit stream are read out. As previouslydescribed, the codeword using in the conventional encoding system havevariable code length. For example, in a case that nine bits of a streamof input data are successively received, the first bit may indicate afirst codeword having a size of 1, the second to sixth bits may indicatea second codeword having a size of 5, and the seventh to ninth bits mayindicate a third codeword having a size of 3. Since the conventionalHuffman decoder fails to identify which bits of the input data streamindicate a complete codeword, the bits of the input data stream need tobe decoded one by one according to the conventional binary tree searchtechnique.

By means of the Huffman decoding device 300 of the present invention, 16bits of the compression bit stream 360 are decoded at one time and thusthe decoding speed is enhanced. The 16-bit compression bit stream 360may be simultaneously compared with multiple Huffman codes included inthe Huffman table. After the comparison, the size/symbol codecorresponding to a first codeword of the compression bit stream isdecoded.

Hereinafter, a procedure of comparing the compression bit stream withthe Huffman table will be illustrated as follows.

Firstly, the preceding 16 bits of a compression bit stream 360 (e.g.“1010,1010,1010,1010”) are successively inputted. Then, the input datastream “1010,1010,1010,1010” is compared with the 12 Huffman codesincluded in the Huffman table so as to obtain the corresponding Huffmancode.

For example, the symbol A at the address “0” has a size code “1” and aHuffman code “1000,0000,0000,0000”. According to the size code, acorresponding 16-bit mask code is generated. The mask code includes avalid bit portion and an invalid bit portion, and the bit-size of thevalid bit portion of the mask code is determined according to the sizecode. In the size code, the first bit and the remainder 15 bits of the16-bit mask code belong to the valid portion and invalid portion,respectively. If the bit “0” indicates a valid bit and the bit “1”indicates an invalid bit, the obtained mask code is“0111,1111,1111,1111”. Whereas, if the bit “1” indicates a valid bit andthe bit “0” indicates an invalid bit, the obtained mask code is1000,0000,0000,0000″. The rest may be deduced by analogy. In theembodiment, the size code 3302 indicates the bit-size of the codewordincluded in the Huffman code 320 and the mask code 350 is determinedaccording to the size code 3302. Since the Huffman code“1000,0000,0000,0000” has a size code “1”, the first bit “1” of thisHuffman code 320 denotes the corresponding codeword.

Next, the compression bit stream processing unit 307 performs a maskingoperation on the mask code 350 (“0111,1111,1111,1111”) and the 16-bitcompression bit stream 360 (“1010,1010,1010,1010”), thereby outputting amasking result 370. The term “masking operation” used herein indicatesthat the 16-bit mask code and the 16-bit compression bit stream areoperated by an AND gate or an OR gate. In a case that the bit “0”indicates a valid bit and the bit “1” indicates an invalid bit, the ANDgate is selected for performing the masking operation. Whereas, in acase that the bit “1” indicates a valid bit and the bit “0” indicates aninvalid bit, the OR gate is selected for performing the maskingoperation. In this embodiment, the AND gate is selected for performingthe masking operation, and the obtained masking result 370 is“0010,1010,1010,1010”.

Next, the Huffman code processing unit 308 receives the Huffman codes320 (“1000,0000,0000,0000”) from the Huffman memory 304, and performs alogic operation on the Huffman codes 320 (“0010,1010,1010,1010”) and themasking result 370 (“0010,1010,1010,1010”). The term “logic operation”used herein indicates that the 16-bit Huffman code 320 and the 16-bitmasking result 370 are operated by an AND gate or an OR gate. In a casethat the bit “0” indicates a valid bit and the bit “1” indicates aninvalid bit, the OR gate is selected for performing the logic operation.Whereas, in a case that the bit “1” indicates a valid bit and the bit“0” indicates an invalid bit, the AND gate is selected for performingthe logic operation. In this embodiment, the OR gate is selected forperforming the logic operation, thereby generating a new Huffman code380 (i.e. “1010,1010,1010,1010”). The new Huffman code 380 also includesa codeword “1”.

By means of the Huffman decoding unit 309, the new Huffman code 380(“1010,1010,1010,1010”) is compared with the 16-bit compression bitstream 360 (“1010,1010,1010,1010”). Since the 16-bit compression bitstream 360 complies with the new Huffman code 380, the Huffman decodingunit 309 will output the corresponding size/symbol code 330. In thisembodiment, since the first bit of the input data stream denotes thecodeword at the address “0”, the size/symbol code of 1/A will be readout.

The procedures of comparing the compression bit stream with the other 11Huffman codes included in the Huffman table are identical to thatdescribed above. Since the Huffman table has been established byencoding all possible compression bit streams, every 16-bit compressionbit stream will correspond to a Huffman code at a specific address. Inthe above embodiment, the first bit of the input data stream denotes thecodeword of the Huffman code at the address “0”. Since one size/symbolcode at the address “0” has been decoded, the Huffman codes at otheraddresses are impossible to match the input data stream.

Since the first bit of the 16-bit compression bit stream has beendecoded, the Huffman decoding device 300 will receive an addition bit inorder that the next compression bit stream still has 16 bits.

The above embodiment is illustrated by referring to one Huffman codeprocessing procedure. Nevertheless, the Huffman decoding method of thepresent invention can be applied to process multiple Huffman codes so asto obtain multiple new Huffman codes. Therefore, the successive 16 bitsof the compression bit stream may be simultaneously compared withmultiple Huffman codes.

Hereinafter, a procedure of simultaneously comparing the compression bitstream with 12 Huffman codes in the Huffman table of FIG. 3( b) will beillustrated as follows.

Firstly, the 16 bits of a compression bit stream 360 (e.g.“1010,1010,1010,1010”) are successively inputted. Then, the 12 Huffmancodes included in the Huffman table are processed as described above,thereby obtaining 12 new Huffman codes, “1010,1010,1010,1010”,“0010,1010,1010,1010”, . . . , and so on. Since the first new Huffmancode complies with the compression bit stream 360, the size/symbol codeof 1/A will be read out. Meanwhile, since the first bit of thecompression bit stream 360 has been decoded, the codeword having a bitsize of 1 is removed and the remaindering input data stream includes 15bits, i.e. “0101,0101,0101,010”. For maintaining 16 bits, an additionalbit, e.g. “0”, is supplemented such that a next input data stream“0101,0101,0101,0100” is intended to be further decoded. Generally, oneor additional bits to be supplemented are determined according to theexisting bits of the compression bit stream 360.

After the new input data stream “0101,0101,0101,0100” is received, the12 Huffman codes included in the Huffman table are processed asdescribed above, thereby obtaining 12 new Huffman codes. The first newHuffman code is “1101,0101,0101,0100”, the second Huffman code is“0001,0101,0101,0100”. The third Huffman code is “0101,0101,0101,0100”.The fourth Huffman code is “0111,1101,0101,0100”. The fifth Huffman codeis “0101,0101,0101,0100”. The rest may be deduced by analogy. Next, thenew input data stream “0101,0101,0101,0100” is successively comparedwith the 12 new Huffman codes. The data matching result shows that thefirst new Huffman code and the second new Huffman code do not complywith the new input data stream, but the third Huffman code complies withthe new input data stream. Meanwhile, the size/symbol code of 5/D isread out and the codeword having a bit size of 5 is removed. Formaintaining 16 bits, five additional bits are supplemented into a nextinput data stream. The above decoding procedures are continued until allbits of the compression bit stream 360 have been recorded.

In the above embodiment, the Huffman decoding device 300 is effectivefor decoding the compression bit stream at an enhanced speed. TheHuffman table shown in FIG. 3( b) contains only 12 Huffman codes. Inpractice, the Huffman table used in the industry may contain severalhundreds of Huffman codes. In this circumstance, the circuitry and thehardware required for establishing the Huffman decoding device becomemore complicated and huge and thus the Huffman decoding device is notcost-effective.

Hereinafter, a further embodiment of a Huffman decoding device withreduced hardware and cost will be illustrated as follows with referenceto FIG. 3( d).

FIG. 3( d) is a schematic circuit block diagram of a Huffman decodingdevice according to a second preferred embodiment of the presentinvention. In comparison with FIG. 3( c), a multi-stage processing unit311 is electrically connected downstream of the Huffman decoding device300 and the Huffman table extracting and processing unit 303 has afunction of dividing the Huffman table into several groups. For example,500 data codes 310 are transmitted to the Huffman table extracting andprocessing unit 303 through the bus interface 302. These data codes 310are processed by the Huffman table extracting and processing unit 303,thereby generating corresponding Huffman codes 320, size/symbol codes330 and mask codes 350. Moreover, during the decoding process, these 500Huffman codes 320 which are stored in the Huffman memory 304 are dividedinto 5 groups such that each group contains 100 Huffman codes 320.Likewise, the size/symbol codes 330 in the symbol and size code memory305 and the mask codes 350 in the mask memory 306 are also divided into5 groups. In every stage, only one group of Huffman codes 320,size/symbol code 330 and mask codes 350 are processed.

Then, 16 bits of a compression bit stream 360 are successively inputtedinto the compression bit stream processing unit 307, and a first groupof mask codes 350 are issued from the mask memory 306 to the bit streamprocessing unit 307. In response to the mask codes 350, the compressionbit stream processing unit 307 performs masking operations on the 16-bitcompression bit stream 360 and the first group of mask codes 350,thereby outputting 100 masking results 370. By the Huffman codeprocessing unit 308, logic operations are performed on these 100 maskingresults 370 and the first group of Huffman code 320, thereby generatinga first group of 100 new Huffman codes 380. The Huffman decoding unit309 receives the first group of size/symbol codes 330 from the symboland size code memory 305 and successively receives the 16 bits of thecompression bit stream 360. By means of the Huffman decoding unit 309,the 16-bit compression bit stream 360 is compared with these 100 newHuffman codes 380 at a time. In a case that none of the first group ofnew Huffman codes 380 complies with the 16-bit compression bit stream360, a null signal “0” is transmitted to the multi-stage processing unit311. Subsequently, a second group of mask codes 350 are issued from themask memory 306, and the above-mentioned masking operations and logicoperations are performed to generate a second group of 100 new Huffmancodes 380. In a case that none of the second group of new Huffman codes380 complies with the 16-bit compression bit stream 360, a null signal“0” is transmitted to the multi-stage processing unit 311. The aboveprocedures are repeated until a specific new Huffman code 380 complieswith the 16-bit compression bit stream 360. Once the specific newHuffman code 380 is searched, the Huffman decoding unit 309 willtransmit the corresponding size/symbol code 330 to the multi-stageprocessing unit 311. In the multi-stage processing unit 311, the nullsignals “0” and the decoded size/symbol code 330 are operated by an ORgate, thereby outputting the decoded size/symbol code 330. Similarly,the codeword having a bit size corresponding to the decoded size/symbolcode 330 is removed, and identical number of bits corresponding to theremoved codeword is supplemented into a next input data stream so as tomaintain 16 bits. The above decoding procedures are continued until allbits of the compression bit stream 360 have been recorded.

From the second embodiment, since a group of 100 new Huffman codesparticipate in the data-matching procedure at one time, at most fivedata-matching procedures are required for processing 500 new Huffmancodes. As a consequence, the overall decoding time may be extended whencompared with the first embodiment of FIG. 3( c). However, since thecircuitry and the hardware required for establishing the Huffmandecoding device of FIG. 3( d) are simplified, the second embodiment ismore cost-effective.

From the above description, the Huffman decoding method and the Huffmandecoding device of the present invention are effective for implementingdata matching of multiple Huffman codes. In comparison with theconventional binary tree search technique of decoding the bits of theinput data stream one by one, the Huffman decoding method of the presentinvention may be implemented at an enhanced decoding speed.

While the invention has been described in terms of what is presentlyconsidered to be the most practical and preferred embodiments, it is tobe understood that the invention needs not be limited to the disclosedembodiment. On the contrary, it is intended to cover variousmodifications and similar arrangements included within the spirit andscope of the appended claims which are to be accorded with the broadestinterpretation so as to encompass all such modifications and similarstructures.

1. A Huffman decoding method for decoding a compression bit stream intocorresponding size/symbol codes, said Huffman decoding method comprisingsteps of: extracting a Huffman table comprising multiple Huffman codesand multiple corresponding size/symbol codes, wherein each Huffman codecomprises a codeword having variable code length and each size/symbolcode comprises a size code and a symbol code; generating multiple maskcodes according to said size codes; performing masking operations onsuccessive 16 bits of said compression bit stream and said mask codes,thereby outputting multiple masking results; performing logic operationson said masking results and said Huffman codes, thereby generatingmultiple new Huffman codes, wherein each new Huffman code includes saidcodeword; discriminating whether said 16 bits of said compression bitstream complies with a specific one of new Huffman codes; and outputtingthe size/symbol code corresponding to said codeword.
 2. The Huffmandecoding method according to claim 1 wherein each mask code is composedof 16 binary codes and includes a valid bit portion and an invalid bitportion, wherein the bit-size of said valid bit portion of said maskcode is determined according to said size code.
 3. The Huffman decodingmethod according to claim 2 wherein an AND gate and an OR gate are usedfor performing said masking operation and said logic operation,respectively, if the bit “0” indicates a valid bit and the bit “1”indicates an invalid bit.
 4. The Huffman decoding method according toclaim 2 wherein an OR gate and an AND gate are used for performing saidmasking operation and said logic operation, respectively, if the bit “1”indicates a valid bit and the bit “0” indicates an invalid bit.
 5. AHuffman decoding device for decoding a compression bit stream intocorresponding size/symbol codes, said Huffman decoding devicecomprising: a Huffman table extracting and processing unit forextracting a Huffman table and generating multiple mask codes, saidHuffman table comprising multiple Huffman codes and multiplecorresponding size/symbol codes, wherein each Huffman code comprises acodeword having variable code length, each size/symbol code includes asize code and a symbol code, and said mask codes are generated accordingto said size codes; a Huffman memory electrically connected to saidHuffman table extracting and processing unit for storing said Huffmancodes therein; a symbol and size code memory electrically connected tosaid Huffman table extracting and processing unit for storing saidsize/symbol codes therein; a mask memory electrically connected to saidHuffman table extracting and processing unit for storing said mask codestherein; a compression bit stream processing unit electrically connectedto said mask memory and performing masking operations on successive 16bits of said compression bit stream and said mask codes, therebyoutputting multiple masking results; a Huffman code processing unitcommunicated with said Huffman table extracting and processing unit forperforming logic operations on said masking results and said Huffmancodes, thereby generating multiple new Huffman codes, wherein each newHuffman code includes said codeword; and a Huffman decoding unitcommunicated with said Huffman table extracting and processing unit fordiscriminating whether said 16 bits of said compression bit streamcomplies with a specific one of new Huffman codes, thereby outputtingthe size/symbol code corresponding to said specific new Huffman code. 6.The Huffman decoding device according to claim 5 wherein each mask codeis composed of 16 binary codes and includes a valid bit portion and aninvalid bit portion, wherein the bit-size of said valid bit portion ofsaid mask code is determined according to said size code.
 7. The Huffmandecoding device according to claim 6 wherein an AND gate and an OR gateare used for performing said masking operation and said logic operation,respectively, if the bit “0” indicates a valid bit and the bit “1”indicates an invalid bit.
 8. The Huffman decoding device according toclaim 6 wherein an OR gate and an AND gate are used for performing saidmasking operation and said logic operation, respectively, if the bit “1”indicates a valid bit and the bit “0” indicates an invalid bit.